package com.hzjq.fxlib.event

import com.wxl.common.util.DateUtils
import org.greenrobot.eventbus.EventBus

class LogEvent {
    var action = ""
    var time = ""
    var timeMillis = 0L
    var title = ""
    var msg = ""
    var electric = ""
    var voltage = ""

    constructor(action: String) {
        this.action = action
        this.timeMillis = System.currentTimeMillis()
        this.time = DateUtils.getYMDHMS()
    }

    companion object {
        fun send(title:String,action: String,msg:String){
            val e = LogEvent(action)
            e.msg = msg
            e.title = title
            EventBus.getDefault().post(e)
        }

        fun send(title:String,action: String,msg:String,electric:String,voltage:String){
            val e = LogEvent(action)
            e.msg = msg
            e.title = title
            e.electric = electric.replace("电流:","")
            e.voltage = voltage.replace("电压:","")
            EventBus.getDefault().post(e)
        }
    }
}